import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from "unplugin-auto-import/vite"

const proxyTable = [
  '/mock'
]

// 开发代理
let proxy = {}
proxyTable.forEach(path => {
  proxy[path] = {
    target: 'http://106.15.186.55:6008/',
    changeOrigin: true
  }
})

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport ({
      imports: ["vue", "vue-router", "pinia"] // 自动导入vue、vue-router、pinia相关函数
      // dts: "src/auto-import.d.ts" // 生成 `auto-import.d.ts` 全局声明
    })
  ],
  server: {
    host: '0.0.0.0',
    port: 3157,
    open: true,
    // disableHostCheck: true,
    proxy: {
      '/api': {
        target: 'http://106.15.186.55:6008/',
        changeOrigin: true,
      }
    }
  }
})
